package co.fitstart.entity.course.round;

import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import org.hibernate.annotations.DynamicUpdate;

import com.alibaba.fastjson.annotation.JSONField;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;

/**
 * 远期目标
 * @author haiyan_xiao
 *
 */
@Entity
@Table(name = "goal")
@DynamicUpdate
@JsonIgnoreProperties(value={"hibernate_lazy_initializer","handler","fieldHandler"})
public class Goal {
    
    @Id
    @GeneratedValue
    private Long id;
    
    /** 课次 */
    @ManyToOne(fetch = FetchType.LAZY, optional = false)
    private CourseRound courseRound;
    
    /** 达成时间 */
    private String reachTime;
    
    /** 远期目标内容 */
    private String content;
    
    /** 创建时间 */
    @JSONField(serialize = false)
    private Date createTime;
    
    @Column(name = "is_disabled")
    private boolean disabled;
    
    public Goal() {
        
    }
    
    public Goal(CourseRound courseRound) {
        this.courseRound = courseRound;
        this.createTime = new Date();
        this.disabled = false;
    }
    
    /**
     * 
     * @param reachTime
     * @param content
     * @return
     */
    public Goal edit(String reachTime, String content) {
        this.reachTime = reachTime;
        this.content = content;
        
        return this;
    }

    /**
     * @return the id
     */
    public Long getId() {
        return id;
    }

    /**
     * @return the courseRound
     */
    public CourseRound getCourseRound() {
        return courseRound;
    }

    /**
     * @return the reachTime
     */
    public String getReachTime() {
        return reachTime;
    }

    /**
     * @return the content
     */
    public String getContent() {
        return content;
    }

    /**
     * @return the createTime
     */
    public Date getCreateTime() {
        return createTime;
    }

    /**
     * @return the disabled
     */
    public boolean isDisabled() {
        return disabled;
    }

    /**
     * @param id the id to set
     */
    public void setId(Long id) {
        this.id = id;
    }

    /**
     * @param courseRound the courseRound to set
     */
    public void setCourseRound(CourseRound courseRound) {
        this.courseRound = courseRound;
    }

    /**
     * @param reachTime the reachTime to set
     */
    public void setReachTime(String reachTime) {
        this.reachTime = reachTime;
    }

    /**
     * @param content the content to set
     */
    public void setContent(String content) {
        this.content = content;
    }

    /**
     * @param createTime the createTime to set
     */
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }

    /**
     * @param disabled the disabled to set
     */
    public void setDisabled(boolean disabled) {
        this.disabled = disabled;
    }
}
